Skip to content

Create postgres project scaffold on local init#241

Merged
sdairs merged 2 commits into
mainfrom
issue-221-postgres-init-dirs
Jun 9, 2026
Merged

Create postgres project scaffold on local init#241
sdairs merged 2 commits into
mainfrom
issue-221-postgres-init-dirs

Conversation

@sdairs

@sdairs sdairs commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #221.

local init previously only created the clickhouse/ project scaffold. It now also creates a postgres/ scaffold so Postgres project files have a home.

The Postgres scaffold is PG-native rather than a mirror of the ClickHouse one: plain views/ and functions/ (procedures) are far more central to a Postgres project than ClickHouse-style materialized views — in Postgres a materialized view is just a manually-refreshed query snapshot, not an insert-time pipeline.

clickhouse/
├── tables/
├── materialized_views/
├── queries/
└── seed/
postgres/
├── tables/
├── views/
├── functions/
├── queries/
└── seed/

Each subdir gets a .gitkeep.

Changes

  • init.rs: added postgres_project_dir(); generalized create_project_scaffold to take an explicit target dir + subdirs and call it for both engines.
  • Added unit tests covering scaffold creation (dirs + .gitkeep) and idempotency.
  • Updated the local init agent help text and README.md.

Testing

  • cargo test -p clickhousectl
  • cargo clippy -p clickhousectl

🤖 Generated with Claude Code


Note

Low Risk
Filesystem-only init scaffolding and docs; no runtime server, auth, or data-path behavior changes.

Overview
clickhousectl local init now scaffolds a committed postgres/ tree alongside the existing clickhouse/ layout, so Postgres SQL assets have a standard home next to ClickHouse project files.

Scaffold creation is refactored: create_project_scaffold takes a target directory and subdirectory list and is invoked twice—clickhouse/ keeps tables, materialized_views, queries, seed; postgres/ gets tables, views, functions, queries, seed (each with .gitkeep). postgres_project_dir() was added for the new root. Unit tests cover directory/.gitkeep creation and idempotent re-runs. README and local init agent help text document both trees.

Reviewed by Cursor Bugbot for commit 54d974b. Bugbot is set up for automated code reviews on this repo. Configure here.

`local init` now creates a `postgres/` scaffold (tables/, materialized_views/,
queries/, seed/) alongside the existing `clickhouse/` scaffold, so Postgres
project files have a home too.

Generalized `create_project_scaffold` to take the target dir and subdirs, added
unit tests covering creation and idempotency, and updated the agent help text
and README.

Closes #221

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sdairs sdairs requested a review from iskakaushik as a code owner June 5, 2026 12:43
Postgres scaffold now uses tables/, views/, functions/, queries/, seed/ —
plain views and functions/procedures are far more central to a Postgres
project than ClickHouse-style materialized views, which in PG are just
manually-refreshed query snapshots.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@iskakaushik iskakaushik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Clean refactor — create_project_scaffold generalized to (dir, subdirs) and called for both engines, with PG-native subdirs. Tests cover creation + idempotency; docs and agent help updated. CI green.

@sdairs sdairs merged commit ff796b6 into main Jun 9, 2026
3 checks passed
@sdairs sdairs deleted the issue-221-postgres-init-dirs branch June 9, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add postgres dir init to local init

2 participants